function generate (min, max, count) {
  if(max < min) return
  let map = new Map()
  let numbers = []
  for(let i = 0;i < count;i ++){
    let value = Math.floor(Math.random() * max) + min
    if(map.has(value)){
      count ++
    }else{
      numbers.push(value)
      map.set(value, 1)
    }
  }
  return numbers
}

let res = generate(1,100,2)
res = res.sort((a,b) => b - a)
console.log(res, res.length)